<?php

session_start();
include_once( 'config.php' );
include_once( 'weibooauth.php' );



$o = new WeiboOAuth( WB_AKEY , WB_SKEY , $_SESSION['app_keys_sina']['oauth_token'] , $_SESSION['app_keys_sina']['oauth_token_secret']  );

$last_key = $o->getAccessToken(  $_REQUEST['oauth_verifier'] ) ;

$_SESSION['last_key_sina'] = $last_key;
unset($_SESSION['app_keys_sina']);
$c = new WeiboClient( WB_AKEY , WB_SKEY , $_SESSION['last_key_sina']['oauth_token'] , $_SESSION['last_key_sina']['oauth_token_secret']  );
$me = $c->verify_credentials();

header('Location: http://'.$_SERVER['HTTP_HOST'].'/home/sina_login'.$_GET['q']);
?>

